home *** CD-ROM | disk | FTP | other *** search
/ The Disc - MacWorld 1995 / PowerComputing (The Disc)(MacWorld 1995).ISO / mac / CDFACTOR / HCfactor / HumanCode / HumanCode.DXR / 00044_index script.ls < prev    next >
Encoding:
Text File  |  1995-07-14  |  4.0 KB  |  113 lines

  1. global gindexmaplist, ggridlist, theBlitPict, gKeywordDataList, gmasterfolderpath, gFileName, objIndexBtn, gIndexRectList, objalphabetbtn, glastline, gkeywordtext, gSelLine, glineoffset, gColor, objCaptureGrid
  2.  
  3. on startindex
  4.   set the mouseDownScript to "indexMouseDownScript"
  5.   repeat with m = 1 to count(gindexmaplist)
  6.     set theList to getAt(gindexmaplist, m)
  7.     drawIndexBtn(m, count(theList), #GRAY)
  8.     repeat with n = 1 to count(theList)
  9.       if getAt(theList, n) = 1 then
  10.         drawIndexBtn(m, n, #BLUE)
  11.       end if
  12.     end repeat
  13.   end repeat
  14.   blitPictInitScreen(theBlitPict, getAt(ggridlist, 6))
  15.   blitPictDrawObj(theBlitPict, the srcrect of theBlitPict, the POINTER of objCaptureGrid, the srcrect of objCaptureGrid, "copy")
  16.   blitPictDispose(theBlitPict)
  17.   if gSelLine = 0 then
  18.     showKeyword(1, 0)
  19.   else
  20.     showKeyword(gSelLine, 1)
  21.     drawkeywords(gSelLine)
  22.   end if
  23. end
  24.  
  25. on drawkeywords selectedkeyword
  26.   blitPictDrawScreen(objCaptureGrid, the srcrect of objCaptureGrid, getAt(ggridlist, 6), "copy", 0, 0)
  27.   repeat with keywordData in getAt(gKeywordDataList, selectedkeyword)
  28.     drawIndexBtn(getAt(keywordData, 1), getAt(keywordData, 2), #YELLOW)
  29.   end repeat
  30. end
  31.  
  32. on killCaptureGrid
  33.   blitPictDispose(objCaptureGrid)
  34. end
  35.  
  36. on setIndexBtn
  37.   set pictfilepath to gmasterfolderpath & getProp(gFileName, #INDEXBTN)
  38.   blitPictInitFile(objIndexBtn, pictfilepath)
  39.   set gIndexRectList to [:]
  40.   addProp(gIndexRectList, #GRAY, "0,0,12,12")
  41.   addProp(gIndexRectList, #BLUE, "324,0,336,12")
  42.   addProp(gIndexRectList, #YELLOW, "336,0,348,12")
  43.   set pictfilepath to gmasterfolderpath & getProp(gFileName, #Alphabet)
  44.   blitPictInitFile(objalphabetbtn, pictfilepath)
  45.   blitPictInitScreen(objCaptureGrid, getAt(ggridlist, 6))
  46. end
  47.  
  48. on drawIndexBtn lesson, Chapter, theButton
  49.   if theButton = #GRAY then
  50.     set srcrect to "0,0," & 12 * Chapter & ",12"
  51.     set theL to getAt(ggridlist, 1)
  52.     set theT to getAt(ggridlist, 2) + ((lesson - 1) * 12)
  53.     blitPictDrawScreen(objIndexBtn, srcrect, theL & "," & theT & "," & theL + (12 * Chapter) & "," & theT + 12, "copy", 0, 0)
  54.   else
  55.     set srcrect to getProp(gIndexRectList, theButton)
  56.     set theL to getAt(ggridlist, 1) + ((Chapter - 1) * 12)
  57.     set theT to getAt(ggridlist, 2) + ((lesson - 1) * 12)
  58.     blitPictDrawScreen(objIndexBtn, srcrect, theL & "," & theT & "," & theL + 12 & "," & theT + 12, "copy", 0, 0)
  59.   end if
  60. end
  61.  
  62. on killIndexBtn
  63.   blitPictDispose(objIndexBtn)
  64.   blitPictDispose(objalphabetbtn)
  65. end
  66.  
  67. on showKeyword lineNumber, switchOn
  68.   set the foreColor of cast 34 to getAt(gColor, 4)
  69.   if glastline > 24 then
  70.     if lineNumber < 3 then
  71.       set glineoffset to 0
  72.       set the text of cast 34 to line 1 to 23 of gkeywordtext & RETURN
  73.       set the visible of sprite 30 to 0
  74.       set the visible of sprite 31 to 1
  75.       updateStage()
  76.       if switchOn then
  77.         set the foreColor of line lineNumber of cast 34 to getAt(gColor, 5)
  78.       end if
  79.     else
  80.       if (lineNumber + 23) > glastline then
  81.         set glineoffset to glastline - 24
  82.         set theText to line glastline - 22 to glastline of gkeywordtext
  83.         set the text of cast 34 to RETURN & theText
  84.         set the visible of sprite 30 to 1
  85.         set the visible of sprite 31 to 0
  86.         updateStage()
  87.         if switchOn then
  88.           set the foreColor of line lineNumber - glineoffset of cast 34 to getAt(gColor, 5)
  89.         end if
  90.       else
  91.         set glineoffset to lineNumber - 2
  92.         set theText to line lineNumber to lineNumber + 21 of gkeywordtext
  93.         set the text of cast 34 to RETURN & theText & RETURN
  94.         set the visible of sprite 30 to 1
  95.         set the visible of sprite 31 to 1
  96.         updateStage()
  97.         if switchOn then
  98.           set the foreColor of line 2 of cast 34 to getAt(gColor, 5)
  99.         end if
  100.       end if
  101.     end if
  102.   else
  103.     set the visible of sprite 30 to 0
  104.     set the visible of sprite 31 to 0
  105.     updateStage()
  106.     set the text of cast 34 to gkeywordtext
  107.     set the foreColor of cast 34 to getAt(gColor, 4)
  108.     if switchOn then
  109.       set the foreColor of line lineNumber of cast 34 to getAt(gColor, 5)
  110.     end if
  111.   end if
  112. end
  113.